#ifndef CONFIGPANEL_H
#define CONFIGPANEL_H

#include <QWidget>
#include <QJsonObject>
#include "../core/ObfuscatorEngine.h"

QT_BEGIN_NAMESPACE
class QCheckBox;
class QLineEdit;
class QListWidget;
class QTextEdit;
class QPushButton;
QT_END_NAMESPACE

class ConfigPanel : public QWidget {
    Q_OBJECT
    
public:
    explicit ConfigPanel(QWidget *parent = nullptr);
    ~ConfigPanel();
    
    // 获取混淆配置
    ObfuscationConfig getObfuscationConfig() const;
    
    // 获取配置JSON
    QJsonObject getConfig() const;
    
    // 加载配置
    void loadConfig(const QJsonObject &config);
    
    // 添加排除路径
    void addExcludePath(const QString &path);
    
    // 设置项目加载状态
    void setProjectLoaded(bool loaded);
    
signals:
    void configChanged();
    void requestExcludeFromProject();  // 请求从项目树选择排除路径
    
private:
    void setupUi();
    
    // 混淆选项
    QCheckBox *m_obfuscateClassesCheck;
    QCheckBox *m_obfuscatePropertiesCheck;
    QCheckBox *m_obfuscateMethodsCheck;
    QCheckBox *m_injectTrashCodeCheck;
    QCheckBox *m_encryptStringsCheck;
    
    // 命名规则
    QLineEdit *m_prefixEdit;
    QLineEdit *m_suffixEdit;
    QLineEdit *m_minLengthEdit;
    QLineEdit *m_maxLengthEdit;
    
    // 排除路径
    QListWidget *m_excludeList;
    QPushButton *m_browseExcludeButton;  // 选择文件夹按钮
    QPushButton *m_fromProjectButton;    // 从项目选择按钮
    QPushButton *m_removeExcludeButton;  // 移除按钮
    
    // 白名单
    QTextEdit *m_classWhitelist;     // 类名白名单
    QTextEdit *m_propertyWhitelist;  // 属性白名单
    QTextEdit *m_methodWhitelist;    // 方法白名单
};

#endif // CONFIGPANEL_H